﻿using MyHospital.BLL;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace MyHospital.web
{
    public partial class UpdateDoctor : System.Web.UI.Page
    {
        Doctor doctor = new Doctor();
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                int doctorID = int.Parse(Request.QueryString["doctorID"]);
                txtUpdateName.Text = doctor.getDoctorName(doctorID);
                txtUpdateAge.Text = doctor.getDoctorAge(doctorID);
                txtUpdateJob.Text = doctor.getDoctorJob(doctorID);
                txtUpdatePhone.Text = doctor.getDoctorPhone(doctorID);
                txtUpdateIntroduce.Text = doctor.getDoctorIntroduce(doctorID);
                txtUpdateImage.Text = doctor.getDoctorImage(doctorID);
                dlsUpdateDepart.SelectedValue = doctor.getDoctorDepart(doctorID).ToString();
            }
        }

        protected void submitUpdateDocter_Click(object sender, EventArgs e)
        {
            int doctorID = int.Parse(Request.QueryString["doctorID"]);
            string txtSex = "";
            if (RadioButton1.Checked) txtSex = "男";
            else if (RadioButton2.Checked) txtSex = "女";
                doctor.updateDoctor(doctorID, txtUpdateName.Text, dlsUpdateDepart.SelectedValue, txtUpdateAge.Text, txtSex, txtUpdatePhone.Text, txtUpdateJob.Text, txtUpdateIntroduce.Text, txtUpdateImage.Text);
                updateLable.Text = "修改成功";
        }
    }
}